//package com.hippo.provider.service.impl;
//
//import com.hippo.core.pojo.entity.RuleWarnDetail;
//import com.hippo.core.pojo.vo.result.BaseResult;
//import com.hippo.drools.fact.Order;
//import com.hippo.provider.service.WarningRuleService;
//import lombok.RequiredArgsConstructor;
//import org.apache.commons.lang3.ObjectUtils;
//import org.drools.core.base.RuleNameStartsWithAgendaFilter;
//import org.kie.api.KieBase;
//import org.kie.api.runtime.KieSession;
//import org.springframework.stereotype.Service;
//
///**
// * @ClassName WarningRuleServiceImpl
// * @Description TODO 预警规则业务处理
// * @Author tangxl
// * @create 2023-05-11 11:40
// **/
//@Service
//@RequiredArgsConstructor
//public class WarningRuleServiceImpl implements WarningRuleService {
//    /**
//     * 规则引擎容器
//     */
//    private final KieBase kieBase;
//
//    /**
//     * 预警规则校验
//     * @return
//     */
//    @Override
//    public BaseResult warnRuleCheck(RuleWarnDetail warnRuleDetail) {
//        KieSession kieSession = kieBase.newKieSession();
//        kieSession.insert(warnRuleDetail);
//        kieSession.fireAllRules();
//        kieSession.dispose();
//        return BaseResult.ok(warnRuleDetail);
//    }
//
//    @Override
//    public BaseResult orderRule(Order order) {
//        if(order.getPrice() == null){
//            return BaseResult.fail("订单金额为空");
//        }
//        KieSession kieSession = kieBase.newKieSession();
//        kieSession.insert(order);
//        kieSession.fireAllRules(new RuleNameStartsWithAgendaFilter("score"));
//        kieSession.dispose();
//        return BaseResult.ok(order);
//    }
//}
